import java.util.ArrayList;
import java.util.Date;
import java.util.Dictionary;
import java.util.Hashtable;

public class PatientBase {
	private int id;
	private int acuity;
	private Date arrivalTime;
	private PatientType type;
	private boolean admit; 
	private TreatmentType activity = null;
	
	public boolean finishedTriage = false;
	public boolean assignedBed = false;
	
	protected ArrayList<TreatmentType> treatmentsNeeded = new ArrayList<TreatmentType>();
	private ArrayList<TreatmentType> tasksCompleted = new ArrayList<TreatmentType>();
		
	public PatientBase(int id, int acuity, Date arrivalTime, PatientType type, boolean admit) {
		this.id = id;
		this.acuity = acuity;
		this.arrivalTime = arrivalTime;
		this.type = type;
		this.admit = admit;
	}
	
	public boolean isAvailable() {
		return false;
	}
	
	public void setActivity(TreatmentType type) {
		this.activity = type;
	}
	
	public String toString() {
		String strActivity = activity == null ? "Idle" : activity.toString();
		return "<" + this.getClass().getName() + ": id=" + this.id + " activity=" + strActivity;
	}
	
	public boolean hasCompleted(TreatmentType type) {
		if(tasksCompleted.contains(type))
			return true;
		else
			return false;
	}	
	
	public void complete(TreatmentType type) {
		tasksCompleted.add(type);
	}
	
	
	public int getId() {
		return id;
	}

	public int getAcuity() {
		return acuity;
	}

	public Date getArrivalTime() {
		return arrivalTime;
	}
	
	public PatientType getType() {
		return type;
	}
	
	public boolean isAdmit() {
		return admit;
	}


	public PatientBase clone() {
		PatientBase p = new PatientBase(id, acuity, arrivalTime, type, admit);
		for(TreatmentType type : treatmentsNeeded)
			p.treatmentsNeeded.add(type);
		for(TreatmentType task : tasksCompleted)
			p.tasksCompleted.add(task);

		return p;
	}
}
